Skip to content

fix(#030, #075): eval alias disjointness + search-scope label pagination#1177

Merged
cursor[bot] merged 18 commits into
mainfrom
cursor/search-correctness-030-075-6273
Jul 25, 2026
Merged

fix(#030, #075): eval alias disjointness + search-scope label pagination#1177
cursor[bot] merged 18 commits into
mainfrom
cursor/search-correctness-030-075-6273

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 24, 2026

Copy link
Copy Markdown
Owner

Summary

Two search-correctness fixes (no ranking/retrieval behaviour change):

  1. Potential fix for code scanning alert no. 1: Workflow does not contain permissions #30 — Remove dual-listed Admission-to-Discharge titles from the wide-tier AdmissionCommunityPts alias list so one retrieved document cannot make �llHit true for both admission and discharge comparison slots.
  2. Refresh dependencies #75 — Add bounded deterministic pagination for document_labels in
    esolveSearchScope (loadScopeLabels) so matches past the Supabase 1,000-row response cap are not silently dropped.
  3. Cleanup — Remove stale PR_POLICY_BODY.md leftover that was overwriting unrelated PR descriptions via Sync PR policy body.

RAG impact: no retrieval behaviour change — eval matching / label pagination only; imputation formulas, comparator key order, and release ranking are unchanged.

Verification

  • Focused Vitest: ests/eval-document-matching.test.ts, ests/search-scope.test.ts
  • [x]
    pm run verify:cheap / local focused suites on this branch
  • UI verification not run: no UI/routing/styling changes
  • Live retrieval/ranking evals not run: no protected ranking formula changes

Risk and rollout

  • Risk: Low — eval matching tables and scope label loading only; released search order and ranking scores unchanged
  • Rollback: revert this PR
  • Provider or production effects: None

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

cursoragent and others added 3 commits July 24, 2026 17:31
A single Admission-to-Discharge document was listed under both
AdmissionCommunityPts and Discharge, so expectedFileCoverage could set
allHit true from one retrieved source. Drop those titles from the
admission side and add fail-closed contract tests.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
A single document_labels query could silently drop matches beyond the
Supabase 1,000-row response cap. Load labels in deterministic
document-batched pages with stable ordering and abort propagation, and
cover multi-page >1000 enumeration in unit contracts.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Archive the wide-tier dual-alias false-pass and search-scope 1k label
truncation fixes; remove the composite recommended-queue row.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@supabase

supabase Bot commented Jul 24, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@BigSimmo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 889c8947-4fb0-44da-a52b-81a46b980d4a

📥 Commits

Reviewing files that changed from the base of the PR and between f733602 and 253a1bb.

📒 Files selected for processing (6)
  • docs/branch-review-ledger.md
  • docs/outstanding-issues.md
  • src/lib/eval-document-matching.ts
  • src/lib/search-scope.ts
  • tests/eval-document-matching.test.ts
  • tests/search-scope.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/search-correctness-030-075-6273

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…ness-030-075-6273

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Correction: PR description was overwritten

This PR is not the search-performance work. Diff vs main is only:

  • #030 eval wide-tier Admission/Discharge alias disjointness (src/lib/eval-document-matching.ts + contracts)
  • #075 search-scope document_labels pagination past the 1k Supabase cap (src/lib/search-scope.ts + contracts)
  • ledger archive of those two issues

RAG impact: no retrieval behaviour change — eval matching / label pagination only.

Follow-up in progress: harden expectedFileCoverage so one retrieved source cannot fill multiple expected-file slots (distinct source identities), then run verify:pr-local.

cursoragent and others added 6 commits July 24, 2026 17:42
expectedFileCoverage now consumes each retrieved top-file at most once
so a combo-titled source cannot false-pass multi-slot allHit. Label
enumeration fails closed after a bounded page budget instead of looping
forever on a stuck full-page API response.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Replace the stale search-performance PR_POLICY_BODY.md leftover on
main so Sync PR policy body stops overwriting this PR with unrelated
summary text. Template will be deleted in a follow-up commit after
the sync job applies it.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Temporary template so Sync PR policy body replaces the stale
search-performance description. Delete in the next commit before merge.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Keep the corrected GitHub PR description without leaving a template
on main that would overwrite later PR bodies (same cleanup pattern
as #942 / #953).

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Append branch-review-ledger entry for the #30/#75 assessment,
distinct-slot/page-budget fixes, and PR_POLICY_BODY cleanup.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor

cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review assessment + follow-up (complete)

Findings fixed on this tip

  1. P2 — Potential fix for code scanning alert no. 1: Workflow does not contain permissions #30 residual: a single combo-titled source (e.g. “Admission of Community Patients and Discharge Planning”) could still make allHit true. Fixed by distinct-source assignment in expectedFileCoverage (each top-file fills at most one expected slot).
  2. P2 — Refresh dependencies #75 residual: unbounded pagination could loop forever if every page returned a full 1000 rows. Added fail-closed page budget per document batch + contract.
  3. P2 process: stale PR_POLICY_BODY.md on main (search-performance leftover) was overwriting this PR’s description via Sync PR policy body. Synced the correct body, then deleted the template so it cannot pollute later PRs.

Verification

  • Focused contracts 32/32
  • verify:cheap green
  • verify:pr-local green (lint/typecheck/3326 unit/build/client-bundle/offline RAG fixtures 36/36)

RAG impact: no retrieval behaviour change — eval matching / label pagination only.

No remaining high-confidence P0–P1 in product scope. Residual: human approving review once required CI finishes on tip d7fc1a93.

cursoragent and others added 3 commits July 24, 2026 17:48
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…ness-030-075-6273

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review July 24, 2026 19:15
@cursor
cursor Bot enabled auto-merge (squash) July 24, 2026 19:17
@github-actions

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 2 failed job(s):

  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #5327 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

BigSimmo and others added 2 commits July 25, 2026 15:16
Keep loadScopeLabels batching, require ScopeLabelRow.id, close #30/#75
in outstanding-issues, and align order() test expectations with composite
label pagination.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@cursor
cursor Bot merged commit 4138c0d into main Jul 25, 2026
18 of 23 checks passed
@cursor
cursor Bot deleted the cursor/search-correctness-030-075-6273 branch July 25, 2026 07:33
BigSimmo added a commit that referenced this pull request Jul 25, 2026
Take main outstanding-issues after #1177 land; keep #66 progress row.

Co-authored-by: Cursor <cursoragent@cursor.com>
BigSimmo added a commit that referenced this pull request Jul 25, 2026
Reconcile outstanding-issues after #1177; keep #7 resolved and #54 progress.

Co-authored-by: Cursor <cursoragent@cursor.com>
BigSimmo added a commit that referenced this pull request Jul 25, 2026
Co-authored-by: Cursor <cursoragent@cursor.com>
cursor Bot pushed a commit that referenced this pull request Jul 25, 2026
* feat(ui): streamline clinical sidebar navigation

* test(ui): align therapy wiring with sidebar scope

* test(ui): align favourites sidebar contract with six-item rail

Assert the canonical sidebarToolItems list (Medications/Factsheets) instead
of main's retired primarySidebarToolIds Forms/Therapy filter.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* style: format favourites sidebar contract test

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* test(ui): fix guide/settings helpers after sidebar streamlining

Tighten mobile menu assertions so Close Clinical Guide menu is not
treated as a Guide affordance, and make openGuide reuse an already-open
Settings dialog (tablet rail + restore path) instead of clicking through
an overlay.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* issues: update #66 with sidebar land proof status

Record feature-branch proof on PR #1174 (focused suites, verify:pr-local,
ensure spot-check, verify:ui). Remaining work is merge to main.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* issues: pin #66 proof SHA to ledger tip

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* issues: align #66 tip SHA with branch HEAD

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* docs: pin #66 proof to content SHA and record review ledger

Cite d97c11e as the content-proof commit for the six-item sidebar land
so later ledger-only tip moves do not churn the issue row.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* issues: clean #66 proof wording

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

* fix(ci): format outstanding issues ledger

* docs: record PR 1174 maintenance

* style: prettier-format outstanding-issues after main merge

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(test): use RegExp name matcher for Guide & help query

Avoid ByRoleOptions exact overload mismatch in favourites-auth-gate DOM test.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(test): disambiguate Medications link in prescribing smoke

Use exact name + first() so rail and breadcrumb links do not trip strict mode.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(docs): remove conflict markers from outstanding-issues

Take main's #30/#75 closures and keep the #66 six-item progress row.

Co-authored-by: Cursor <cursoragent@cursor.com>

* docs(review): append babysit ledger rows for #1177 merge

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants